const { User } = require('../../model/user');
module.exports = async(req, res) => {
    const { message, id } = req.query;
    // console.log(message);
    if (id) {
        //发送修改请求
        let user = await User.findOne({ _id: id });
        res.render('admin/user-edit', { id, button: '修改', user, path: '/admin/modify?id=' + id, message });
    } else {
        //发送添加请求
        res.render('admin/user-edit', { message, path: '/admin/user-edit' });
    }
}